package com.vincent.seeyou.ui;

import android.content.Intent;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.NfcAdapter;
import android.nfc.NfcEvent;
import android.os.Bundle;

import com.vincent.seeyou.nfc.SYNFCManager;

import java.nio.charset.Charset;

import cn.bmob.im.BmobUserManager;

/**
 * Created by vincent on 14-9-1.
 * 除欢迎界面和注册登录界面之外，其他类得基类。
 * 检查是否已经在其他设备登录。
 */
public class BaseAndCheckInActivity extends BaseActivity{


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        //自动登陆状态下检测是否在其他设备登陆
        checkLogin();
    }
    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        checkLogin();
    }

    public void checkLogin() {
        final BmobUserManager userManager = BmobUserManager.getInstance(this);

        if (userManager.getCurrentUser() == null) {
            ShowToast("您的账号已在其他设备上登录!");
            startActivity(new Intent(this, LoginActivity.class));
            finish();
        }
    }

}
